package main

import "fmt"

func main() {
	// var a [3]int
	// a[1] = 10
	// fmt.Println(a[0])
	// fmt.Println(a[1])
	// fmt.Println(a[len(a)-1]) //len 函数是 Go 中的内置函数，用于获取数组、切片或映射中的元素数。

	// cities := [5]string{"北京", "天津", "上海", "重庆", "深圳"}
	// fmt.Println(cities)

	// numbers := [...]int{0: 1, 99: -1}
	// fmt.Println(numbers[0])
	// fmt.Println(numbers[99])

	var twoD [3][5]int
	for i := 0; i < 3; i++ {
		for j := 0; j < 5; j++ {
			twoD[i][j] = (i + 1) * (j + 1)
		}
		fmt.Println("row", i, twoD[i])
	}
	fmt.Println("\nAll at once:", twoD)

	var threeD [3][5][2]int
	for i := 0; i < 3; i++ {
		for j := 0; j < 5; j++ {
			for k := 0; k < 2; k++ {
				threeD[i][j][k] = (i + 1) * (j + 1) * (k + 1)
			}
		}
	}
	fmt.Println("\nall at once:", threeD)
}
